<link  rel="stylesheet" type="text/css"  href="<?php echo Yii::app()->baseUrl?>/css/bid_pack_payment.css"   />
<style>
.errorMessage{
	color: #FF0000;
    font-size: 12px;
    margin-left: 385px;
    width: 155px;
}

</style>
<?php 
$baseUrl = Yii::app()->baseUrl;
$bidtypearray = $buyBidPackInfo['bidtypearray'];
$biddirectly = $buyBidPackInfo['biddirectly'];
?>
<div class="green-sign-box">
	<div class="box-top">
		<div class="green-title"><!-- <i class="icon golds"></i> --><p>Buy Bids</p></div>	
	</div>
    <div class="box-content">
    	<div class="bid-pack-box">
		<?php 
			if(!empty($couponCode)){
		?>
			<div style="width:342px; margin-bottom:10px; margin-left:-15px; font-size:20px; font-weight:bold;">Hurry, there’s only <span id="coupontime" lasttime="600" style="color:#E60012;">00:10:00</span> left to claim this coupon!</div>
        	<div class="bid-pack small" style="position: relative;height: 295px;">
				<div class="bidtype" style="font-size:18px;">
					Coupon Accepted
					<?php //echo ucwords($bidtypearray[$couponCode]);?>
				</div>
				<div class="img" style="margin-top:20px;">
					<?php //var_dump($val);?>
					<img src="<?php echo $baseUrl ?>/images/bid_pack/mini.png" alt="" onclick="getbidpackid(<?php echo $couponCode;?>)" style="cursor:pointer;"/>
				</div>
				<p class="num" style="font-size:18px;"><?php echo $biddirectly[$couponCode]['real_bids']+$biddirectly[$couponCode]['promo_bids']?></p>
                <p class="text" style="font-size:12px;margin-top:0;">BIDS</p>
                <p class="cost" style="font-size:18px;">$<?php echo $biddirectly[$couponCode]['cost_price'] ?></p>
                <!-- <a class="buy-now-btn" href="#"><img alt="" src="<?php echo $baseUrl ?>/images/buy-now-btn.png" /></a> -->
                <div class="coupon-background"></div>
            </div>
            <p class="summary-text" style="margin-top:10px;font-size:18px;">You pay: $<?php echo $biddirectly[$couponCode]['cost_price'] ?><br/>
You receive: <?php echo$biddirectly[$couponCode]['real_bids']+$biddirectly[$couponCode]['promo_bids'];?> bids</p>
			<a class="back-link" href="<?php echo $baseUrl ?>/buybid">&lt;&lt; Back to bidpack selection</a>
			<script>
				$(document).ready(function(){
					setInterval(runLastTime,1000);
				});
				function runLastTime(){
					$lastTime = $('#coupontime').attr('lasttime') - 1;
					var timeText = timeHtml($lastTime);
					if(timeText){
						$('#coupontime').html(timeText);
					}
					$('#coupontime').attr('lasttime',$lastTime);
				}
				
				function timeHtml($times){
					if ($times > 0) {   
					   	$times = $times - 1; 
					   	var day = Math.floor(($times / 3600) / 24);       //璁＄畻澶�
					   	//var hour = Math.floor(($times / 3600) % 24);      //璁＄畻灏忔椂    
					   	var hour = Math.floor($times / 3600);
					   	var minite = Math.floor(($times / 60) % 60);      //璁＄畻鍒�
					   	var second = Math.floor($times % 60);             // 璁＄畻绉�
					   	if(second<10){
					   		second = '0'+ second;
					   	}
					   	if(minite<10){
					   		minite = '0'+ minite;
					   	}
					   	if(hour<10){
					   		hour = '0'+ hour;
					   	}
					   	
					   	if($times == 0){
					   		//alert('123');
					   		//window.location.href = "<?php echo Yii::app()->baseUrl;?>/";
					   		$('.ready-winning-btn').attr('disabled',true);
					   		$('.ready-winning-btn').attr('src','<?php echo Yii::app()->baseUrl;?>/images/ready-winning-gren-btn.png');
					   		$couponCodeLogUrl = '<?php echo Yii::app()->baseUrl?>/ajax/addcouponcodelog';
					   		$.ajax({
				    			type: 'get',
				    	        url: $couponCodeLogUrl,
				    	        data: {'customerId':<?php echo Yii::app()->user->id;?>,'couponCodeId':<?php echo $biddirectly[$couponCode]['id']?>},
				    	        dataType: "json",
				    	        success: function(response){
				    	            
				    	        }
				    		});
					   	}
					   	return hour + ":" + minite + ":" + second;
					} else {
						//return 'SOLD';
						return false;
					} 
				}
			</script>
		<?php }else{?>
			<div class="bid-pack small">
        		<div class="bidtype">
					<?php echo ucwords($bidtypearray[$bidPackId]);?>
				</div>
				<div class="img">
					<?php //var_dump($val);?>
					<img src="<?php echo $baseUrl ?>/images/bid_pack/<?php echo $bidtypearray[$bidPackId];?>.png" alt="" onclick="getbidpackid(<?php echo $bidPackId;?>)" style="cursor:pointer;"/>
				</div>
            	<p class="num"><?php echo $biddirectly[$bidPackId]['bid']?></p>
                <p class="text">BIDS</p>
                <p class="cost">$<?php echo $biddirectly[$bidPackId]['price'] ?></p>
                <a class="buy-now-btn" href="#"><img alt="" src="<?php echo $baseUrl ?>/images/buy-now-btn.png" /></a>
            </div>
            <p class="summary-text">You pay: $<?php echo $biddirectly[$bidPackId]['price'] ?><br/>
You receive: <?php echo $biddirectly[$bidPackId]['bid']?> bids</p>
			<a class="back-link" href="<?php echo $baseUrl ?>/buybid">&lt;&lt; Back to bidpack selection</a>
		<?php 
			}
		?>
        </div>
        
        <?php
			$this->renderPartial('/payment/_billinginfo',array(
					'model'=>$model,
					'baseUrl'=>$baseUrl,
					'bidPackId'=>$bidPackId,
			)); 
		?>
        
    </div>
    <div class="clear"></div>
  </div>